package com.zhang.framelib.util;

import java.io.InputStreamReader;
import java.util.Properties;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * 
 * Title:ConfigUtils
 * Description: 配置文件读取工具
 * @Edit_Description:cuishuaiming
 * @version:zhang-framelib 1.0
 */
public class ConfigUtils {

	private static Logger logger = LoggerFactory.getLogger(ConfigUtils.class);
	
	/**
	 * 读取配置文件
	 * @param confPath 配置文件路径
	 * @return
	 * @Edit_Description:
	 * @Create_Version:zhang-framelib 1.0
	 */
	public static Properties getPropertiesFile(String confPath){
		
		Properties prop = new Properties();
		try {
			InputStreamReader is = new InputStreamReader(ConfigUtils.class
					.getClassLoader().getResourceAsStream(confPath), "UTF-8");
			prop.load(is);
			is.close();
			if(logger.isDebugEnabled()){
				logger.debug("load config file success , filePath is" + confPath);
			}
		} catch (Exception e) {
			if(logger.isErrorEnabled()){
				logger.error("load config file fail , filePath is" + confPath);
			}
		}
		
		return null;
	}
}
